
//  UIImageView+extension.swift

//  Created by laichunhui on 15/9/30.
//  Copyright © 2015年 lch. All rights reserved.

//  对UIImageView的扩展

import UIKit
import Kingfisher

extension UIImageView {
    /// 包装SDWeb框架的图片加载方法
    func vo_setImageWithURL(url: NSURL, placeholderImage: UIImage) {
       // self.sd_setImageWithURL(url, placeholderImage: placeholderImage)
        self.kf_setImageWithURL(url, placeholderImage: placeholderImage)
    }
    
    /// 包装SDWeb加载圆形头像
    func vo_setCircleIconViewWithURL(url: NSURL) {
        
        let placeholder = UIImage(named: "avatar_default_big")?.imageClipOvalImage()
        placeholder
        self.kf_setImageWithURL(url, placeholderImage: placeholder, optionsInfo: [.Transition(ImageTransition.Fade(1))]) { (image, error, cacheType, imageURL) -> () in
            
            self.image = image == nil ? placeholder : image!.imageClipOvalImage()

        }
    }
}
